using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace FiltronASP.Helpers.EnumerableExtensions
{
    public static class EnumerableExtensions
    {
        public static double MinOrDefault<TSource>(this IEnumerable<TSource> source, Func<TSource, double> selector, double defaultValue)
        {
            if (source.Any<TSource>())
            {
                return source.Min<TSource>(selector);
            }   //if
            return defaultValue;
        }

        public static double MaxOrDefault<TSource>(this IEnumerable<TSource> source, Func<TSource, double> selector, double defaultValue)
        {
            if (source.Any<TSource>())
            {
                return source.Max<TSource>(selector);
            }   //if
            return defaultValue;
        }
    }
}